package com.dycong.common.IO.calculator.bio;

import java.io.IOException;
import java.net.Socket;

/**
 * Created by dycong on 2017/3/24.
 * TODO 两个线程操作同一个socket，一个负责读，一个负责写
 */
public class Test1 {
    private static int DEFAULT_SERVER_PORT = 12345;
    private static String DEFAULT_SERVER_IP = "127.0.0.1";


    public static void main(String[] args) {
       try {
           Socket socket=new Socket(DEFAULT_SERVER_IP,DEFAULT_SERVER_PORT);
//           try {
//               socket.setSoTimeout(2000);
//           }catch (SocketException e){
//               System.out.println("java.net.SocketTimeoutException");
//           }
           new Thread(new ClientReader(socket)).start();        //todo 开启客户端监听控制台输入并循环out.write()线程
           new Thread(new ClientWriter(socket)).start();        //todo 开启客户端监听Client消息循环in.read()线程
       }catch (IOException e){

       }

    }
}
